package week_3.homework;

import java.util.Scanner;

public class Pascal2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入你想看到的杨辉三角的行数");
        int n = scan.nextInt();//输入几层是几层
        CircularArrayQueue<Integer> Yanghui = new CircularArrayQueue<Integer>();
        Yanghui.enqueue(0);
        Yanghui.enqueue(1);
        int i = 0;//每一行的第i个元素。
        while(i<=n){
            int x =Yanghui.dequeue();
            int y = Yanghui.first();
            if(x==0)
            {
                i++;
                Yanghui.enqueue(0);
            }
            Yanghui.enqueue(x+y);
            if(x==0)
            {
                System.out.println();
            }
            else
                System.out.print(x+" ");
        }

    }
}
